package com.ad.pet.app.shopcar.confirm.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.common.data.utils.SpUtil;
import com.ad.pet.common.data.utils.glide.GlideUtil;
import com.ad.pet.constant.Constant;
import com.ad.pet.models.remote.cart.Good;

import java.util.List;

/**
 * Created by SEELE on 2018/5/2.
 */

public class ConfirmGoodAdaper extends BaseQuickAdapter<Good, BaseViewHolder> {
    public ConfirmGoodAdaper(@Nullable List<Good> data) {
        super(R.layout.item_confirm_order_layout, data);
    }

    @Override
    protected void convert(final BaseViewHolder helper, final Good item) {
        TextView tvGoodName = helper.getView(R.id.tv_name);
        TextView tv_attribute = helper.getView(R.id.tv_attribute);

        TextView tv_price = helper.getView(R.id.tv_price);
        TextView tv_train_pay = helper.getView(R.id.tv_train_pay);
        GlideUtil.load(mContext, item.getImage(), (ImageView) helper.getView(R.id.iv_head));
        tvGoodName.setText(item.getName());
        tv_attribute.setText(item.getAttr_option());
        tv_price.setText(SpUtil.getInstance().getString(Constant.CURRENCY_LABEL,"US $")+item.getPrice());
        tv_train_pay.setText("x"+item.getQuantity());
        tv_attribute.setVisibility(TextUtils.isEmpty(item.getAttr_option()) ? View.GONE : View.VISIBLE);




    }
}
